<?php 
		$user=$session->read('User');
		$colleageid=$session->read("colleageid");
		//$isflag=$action->checkPermissions($user,$companyid);
		$isflag = true;
?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
    	<h2>
			<?php 
				$colleagename=$session->read("colleagename");
				echo $html->link($colleagename,"/colleages/showcolleageinfo/".$colleageid);
			?>
    	</h2>
    	<div class='clear'></div>
    </div>
    <div class="right back_btn"><?php echo $html->link("返回","/colleages/cgpatents/".$_SESSION['colleageid'])?></div>
    <div class="clear"></div>
</div>


<div class="right_side_scollbar">
    <div class="detail_info_panel">
    	
    	<?php  $statestr = array('模型样机','小试','中试'); ?>
    
    	<div class="right_side_operate_area">
    		<div class="right_side_title left">
    			<h3>专利基本信息</h3>
			</div>
			<div class="clear"></div>
		</div>
		
		<?php 
			echo $form -> create('CgPatent', array('url'=>'/colleages/showcgpatent','enctype'=>'multipart/form-data') ); 
		?>	
		
		<div class="details_item_line">
			<div class="details_item">
					<div class="form_left_title left">专利名称：</div>
					<div class="form_right_input left">
						<?php echo $form->value('CgPatent.name');?>
					</div>
			</div>
 
	        <div class="details_item">
               <div class="form_left_title left">授权时间：</div>
               <div class="form_right_input left">
               		<?php
               				$date = date("Y-m-d",strtotime($form->value('CgPatent.authorized_time')));
               				echo $date;
               		?>
               </div>
            </div>
	    </div>
	    
	    <!--显示图片 开始-->
		<div class="details_item_line">
			<div class="details_item">
                <div class="form_left_title left">专利图片：</div>
                <div class="form_right_e_input left">
                <?php 
	                $photoimg = $photo["file_path"];
	                if($photoimg)
	                {
	                	echo $html->image("/".$photoimg,array("width"=>"200px","height"=>"80px"));
	                }
                ?>
                </div>
       		</div>
		
		<!--显示图片 结束-->
	    
			<div class="details_item">
				<div class="form_left_title left">拥有者：</div>
				<div class="form_right_input left">
					<?php echo $form->value('CgPatent.owner');?>
				</div>
			</div>
		</div>	
		
		<!--所属产业 开始-->
		  <div class="details_item_line">
            <div class="details_item">
            	 <div class="form_left_title left">所属产业：</div>
            	 <div class="form_right_add left">
                	<?php 
		            $industryidlist="";
		            if($pros_cvalues){
			            foreach($pros_cvalues as $pros_cvalue){
			            	if(!empty($pros_cvalue["cvid"])){
			            		$industryidlist.=$pros_cvalue["cvid"].',';
			            	}
			            }
		            }
		            ?>
		            <div id="pcvalueidlist" class="txthide"><?php echo $industryidlist; ?></div>
                	<div id="taglist" class="added_item_list left"></div>
                    <div class="add_item_btn left">
		                <div id="add_float_box" class="add_float_box" style="display:none;">
		                    <ul>
			                    <?php 
					                    $dan="'";
					                    foreach($industrys as $key=>$industry)
					                    {
											echo "<li><label>";
											echo '<input type="checkbox" id="chbox'.$key.'" onclick="settxt(this,'.$dan.$industry.$dan.','.$dan."#ProjectIndustryname".$dan.','.$dan."#ProjectIndustryid".$dan.','.$dan."#taglist".$dan.')" value="'.$key.'" />'.$industry;
											echo "</label></li>";
											echo "<span id='span".$key."' class='txthide'>".$industry."</span>";
										}?> 
							</ul>
		                </div>
					</div>
                    <?php echo $form->text('Project.industryname',array('class'=>'txthide','readonly'=>'true','style'=>'width:500px'));?>
		            <?php echo $form->text('Project.industryid',array('class'=>'txthide'));?>
                </div>
            </div>
        </div>	
		<!--所属产业 结束-->
		
		<div class="details_item_line">
			<div class="details_item">
					<div class="form_left_title left">专利状态：</div>
					<div class="form_right_input left">
						<?php 
							$i = 0;
							while($form->value('CgPatent.state') != $i) $i++;
							echo $statestr[$i];
						?>
					</div>
			</div>
		
	        <div class="details_item">
               <div class="form_left_title left">交易时间：</div>
               <div class="form_right_input left">
               		<?php
               				$saled_date = date("Y-m-d",strtotime($form->value('CgPatent.saled_time')));
               				echo $saled_date;
               		?>
               </div>
            </div>
	    </div>

		<div class="details_item_line">
			<div class="details_item">
					<div class="form_left_title left">专利状态描述：</div>
					<div class="form_right_input left">
						<?php echo $form->value('CgPatent.state_description');?>
					</div>
			</div>
			
			<div class="details_item">
					<div class="form_left_title left">专利介绍：</div>
					<div class="form_right_input left">
						<?php echo $form->value('CgPatent.describe');?>
					</div>
			</div>
		</div>
		
		<div class="details_item_line">
			<div class="details_item">
					<div class="form_left_title left">专利优势：</div>
					<div class="form_right_input left">
						<?php echo $form->value('CgPatent.superiority');?>
					</div>
			</div>

			<div class="details_item">
					<div class="form_left_title left">应用前景：</div>
					<div class="form_right_input left">
						<?php echo $form->value('CgPatent.apply_prospect');?>
					</div>
			</div>
		</div>
		
		<div class="details_item_line">
			<div class="details_item">
					<div class="form_left_title left">使用案例：</div>
					<div class="form_right_input left">
						<?php echo $form->value('CgPatent.usecase');?>
					</div>
			</div>
		</div>
		
		<!--第四行显示附件 开始-->
		 <div class="details_item_line">  
            <div class="details_item">
                <div class="form_left_title left"><?php echo "电子材料" ;?>：</div>
                <div class="left">
                	<div class="file_category_list">
		        		<div id="filelist0" class="file_lists">
		        			<?php $dan="'";
			                	if($attachments){?>
		        			<ul class="picture_attach">
		        				<?php
			                	foreach($attachments as $attachment){
			                			$fname=$attachment["file_name"];
			                			$fpath=$attachment["file_path"];
			                			$fid=$attachment["id"];
			                			$createdtime=date("Y-m-d",strtotime($attachment["created"]));
			                			$isimg=$str->checkimg($fname);
			                			if($isimg){
											echo "<li>";
											echo '<div class="picture_info">';
											echo "<span>".$fname."</span>";
											echo "<span class='source_upload_date'>".$createdtime.$html->link("下载",'/projects/download/'.$attachment["id"],null)."</span>";
											echo "</div>";
											
//											if($user['isadmin'] || $user['isgroupadmin'] || $second_ownerid==$user['id']){
//												echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';
//											}
											$img=$html->image("/".$fpath);
											echo "<span>".$html->link($img,'javascript:void(0);',array('onclick'=>"openimg(".$dan."f".$fid.$dan.")",'escape' => false))."</span>";
											echo "<div style='display:none' id='f".$fid."' title='".$fname."'>".$img."</div>";
											
											echo "</li>";
										}
									}
			                	?>
		        				<div class="clear"></div>
		        			</ul>
		        			<ul class="file_attach">
			                	<?php
			                	foreach($attachments as $attachment){
			                			$fname=$attachment["file_name"];
			                			$isimg=$str->checkimg($fname);
			                			if(!$isimg){
											echo "<li>";
											echo "<span>".$html->link($fname,'/projects/download/'.$attachment["id"],null)."</span>";
											echo "<span class='source_upload_date'>".date("Y-m-d",strtotime($attachment["created"]))."</span>";
//											if($user['isadmin'] || $user['isgroupadmin'] || $second_ownerid==$user['id']){
//												echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';
//											}
											echo "</li>";
										}
									}
			                	?>
			                	<div class="clear"></div>
			                </ul>
			                <?php 
			                	}else{
									echo '<div class="form_right_input left">暂无文件</div>';
								}
			                ?>
		                </div>
		             </div>
				</div>
            </div>
        </div>
		<!--第四行显示附件 结束-->
																																											<!--第二个大块 开始-->
		<div class="right_side_operate_area">
			<div class="right_side_title left">
				<h3>
					<div>专利所化产品</div>			
				</h3>
			</div>
			<div class="right back_btn">
				<?php 
							echo $html->link("编辑产品","/colleages/products/");	
				?>
			</div>
		    <div class="clear"></div>
		</div>
		
		<div class="items_list" >	
			<table>
				<tr>
					<th>产品名称</th>
					<th>转化时间</th>
					<th>合作关系</th>
				</tr>
				
					<?php
     					foreach($products as $product)
     					{
     						 $id = $product["CgProduct"]["id"];
     						 $name = $product["CgProduct"]["name"];
     						 $date = date("Y-m-d",strtotime($product["CgProduct"]["transform_time"]));
     						 $cooperation = $product["CgProduct"]["cooperation"];
     						 
     						 echo "<tr class='per_list'>";
     						 echo "<td>".$html->link($name,"/colleages/showproduct/".$id,null)."</td>";
     						 echo "<td>".$date."</td>";
     						 echo "<td>".$cooperation."</td>";
							 echo "</tr>";
     					}
    		 			?>
				
			</table>
		</div>
																																										<!--第二个大块 结束-->
    
    </div>
</div>
<?php echo $this->element('delfileconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>
<?php echo $javascript->link('project.js');?>